/*
 * \brief Accelerometer module
 * stm_acc.h
 *
 *  Created on: 29-03-2013
 *      Author: Podol
 */

#include "stm_acc.h"
#include "stm_spi.h"
#include "gpio.h"
#include "config.h"

/*------------------------------------------------------------------------*//**
* local functions
*
*//*-------------------------------------------------------------------------*/


/*------------------------------------------------------------------------*//**
* \brief Initialize the accelerometer
* \details
*
* \param (void)
*//*-------------------------------------------------------------------------*/

void acc_init(void)
{
	acc_spi_init();
	acc_spi_transfer(SPI_ACC, ACC_activ_reg); ///ACTIVATE POWER IN CTRL_REG1
}


#if 0
///DISCOVERY BOARD BUTTON ENABLE
static void button_config(void)
{

	EXTI -> IMR |= EXTI_IMR_MR0;	//unmask line 0 (i.e. PA0, PC0 and so on)
		EXTI -> RTSR |= EXTI_RTSR_TR0;	//interrupts on line 0 triggered by a rising slope

		RCC -> APB2ENR |= RCC_APB2ENR_SYSCFGEN;	//syscfg clock
		SYSCFG -> EXTICR[0] |= 0; //PA is a source for EXTI0 interruprt

		NVIC_EnableIRQ(EXTI0_IRQn);
}
#endif
